home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tcl / RecordEval.man < prev    next >
Encoding:
Text File  |  1991-09-26  |  5.7 KB  |  230 lines

  1. '\" Copyright 1989 Regents of the University of California
  2. '\" Permission to use, copy, modify, and distribute this
  3. '\" documentation for any purpose and without fee is hereby
  4. '\" granted, provided that this notice appears in all copies.
  5. '\" The University of California makes no representations about
  6. '\" the suitability of this material for any purpose.  It is
  7. '\" provided "as is" without express or implied warranty.
  8. '\" 
  9. '\" $Header: /sprite/src/lib/tcl/RCS/Tcl_RecordAndEval.man,v 1.2 90/03/09 08:42:42 ouster Exp $ SPRITE (Berkeley)
  10. '\" 
  11. .\" The definitions below are for supplemental macros used in Sprite
  12. .\" manual entries.
  13. .\"
  14. .\" .HS name section [date [version]]
  15. .\"    Replacement for .TH in other man pages.  See below for valid
  16. .\"    section names.
  17. .\"
  18. .\" .AP type name in/out [indent]
  19. .\"    Start paragraph describing an argument to a library procedure.
  20. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  21. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  22. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  23. .\"    needed;  use .AS below instead)
  24. .\"
  25. .\" .AS [type [name]]
  26. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  27. .\"    name are examples of largest possible arguments that will be passed
  28. .\"    to .AP later.  If args are omitted, default tab stops are used.
  29. .\"
  30. .\" .BS
  31. .\"    Start box enclosure.  From here until next .BE, everything will be
  32. .\"    enclosed in one large box.
  33. .\"
  34. .\" .BE
  35. .\"    End of box enclosure.
  36. .\"
  37. .\" .VS
  38. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  39. .\"    of man pages.
  40. .\"
  41. .\" .VE
  42. .\"    End of vertical sidebar.
  43. .\"
  44. .\" .DS
  45. .\"    Begin an indented unfilled display.
  46. .\"
  47. .\" .DE
  48. .\"    End of indented unfilled display.
  49. .\"
  50. '    # Heading for Sprite man pages
  51. .de HS
  52. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  53. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  54. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  55. .if t .wh -1.3i ^B
  56. .nr ^l \\n(.l
  57. ..
  58. '    # Start an argument description
  59. .de AP
  60. .ie !"\\$4"" .TP \\$4
  61. .el \{\
  62. .   ie !"\\$2"" .TP \\n()Cu
  63. .   el          .TP 15
  64. .\}
  65. .ie !"\\$3"" \{\
  66. .ta \\n()Au \\n()Bu
  67. \&\\$1    \\fI\\$2\\fP    (\\$3)
  68. .\".b
  69. .\}
  70. .el \{\
  71. .br
  72. .ie !"\\$2"" \{\
  73. \&\\$1    \\fI\\$2\\fP
  74. .\}
  75. .el \{\
  76. \&\\fI\\$1\\fP
  77. .\}
  78. .\}
  79. ..
  80. '    # define tabbing values for .AP
  81. .de AS
  82. .nr )A 10n
  83. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  84. .nr )B \\n()Au+15n
  85. .\"
  86. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  87. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  88. ..
  89. '    # BS - start boxed text
  90. '    # ^y = starting y location
  91. '    # ^b = 1
  92. .de BS
  93. .br
  94. .mk ^y
  95. .nr ^b 1u
  96. .if n .nf
  97. .if n .ti 0
  98. .if n \l'\\n(.lu\(ul'
  99. .if n .fi
  100. ..
  101. '    # BE - end boxed text (draw box now)
  102. .de BE
  103. .nf
  104. .ti 0
  105. .mk ^t
  106. .ie n \l'\\n(^lu\(ul'
  107. .el \{\
  108. .\"    Draw four-sided box normally, but don't draw top of
  109. .\"    box if the box started on an earlier page.
  110. .ie !\\n(^b-1 \{\
  111. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  112. .\}
  113. .el \}\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .\}
  117. .fi
  118. .br
  119. .nr ^b 0
  120. ..
  121. '    # VS - start vertical sidebar
  122. '    # ^Y = starting y location
  123. '    # ^v = 1 (for troff;  for nroff this doesn't matter)
  124. .de VS
  125. .mk ^Y
  126. .ie n 'mc \s12\(br\s0
  127. .el .nr ^v 1u
  128. ..
  129. '    # VE - end of vertical sidebar
  130. .de VE
  131. .ie n 'mc
  132. .el \{\
  133. .ev 2
  134. .nf
  135. .ti 0
  136. .mk ^t
  137. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  138. .sp -1
  139. .fi
  140. .ev
  141. .\}
  142. .nr ^v 0
  143. ..
  144. '    # Special macro to handle page bottom:  finish off current
  145. '    # box/sidebar if in box/sidebar mode, then invoked standard
  146. '    # page bottom macro.
  147. .de ^B
  148. .ev 2
  149. 'ti 0
  150. 'nf
  151. .mk ^t
  152. .if \\n(^b \{\
  153. .\"    Draw three-sided box if this is the box's first page,
  154. .\"    draw two sides but no top otherwise.
  155. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  156. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  157. .\}
  158. .if \\n(^v \{\
  159. .nr ^x \\n(^tu+1v-\\n(^Yu
  160. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  161. .\}
  162. .bp
  163. 'fi
  164. .ev
  165. .if \\n(^b \{\
  166. .mk ^y
  167. .nr ^b 2
  168. .\}
  169. .if \\n(^v \{\
  170. .mk ^Y
  171. .\}
  172. ..
  173. '    # DS - begin display
  174. .de DS
  175. .RS
  176. .nf
  177. .sp
  178. ..
  179. '    # DE - end display
  180. .de DE
  181. .fi
  182. .RE
  183. .sp.5
  184. ..
  185. .HS Tcl_RecordAndEval tcl
  186. .BS
  187. .SH NAME
  188. Tcl_RecordAndEval \- save a Tcl command in the history list, then execute it
  189. .SH SYNOPSIS
  190. .nf
  191. \fB#include <tcl.h>\fR
  192. .sp
  193. int
  194. \fBTcl_RecordAndEval\fR(\fIinterp, cmd, flags\fR)
  195. .SH ARGUMENTS
  196. .AS Tcl_Interp *interp;
  197. .AP Tcl_Interp *interp in
  198. Interpreter in which to record and execute the command.
  199. .AP char *cmd in
  200. Command (or sequence of commands) to execute.
  201. .AP char flags in
  202. Flags to pass to \fBTcl_Eval\fR (normally 0).  If -1, then the
  203. command is not executed;  it's just recorded.
  204. .BE
  205.  
  206. .SH DESCRIPTION
  207. .PP
  208. \fBTcl_RecordAndEval\fR is invoked to record a command on the history
  209. list and then execute it.  Programs that do not wish to use the history
  210. mechanism should not call \fBTcl_RecordAndEval\fR;  they should call
  211. \fBTcl_Eval\fR instead.  Furthermore, \fBTcl_RecordAndEval\fR should
  212. only be called with top-level commands typed by the user, since the
  213. purpose of history is to allow the user to re-issue recently-invoked
  214. commands.
  215. .PP
  216. This procedure does three things.  First, it initializes history for
  217. the interpreter \fIinterp\fR, if this is the first call for \fIinterp\fR.
  218. Among other things, this makes the \fBhistory\fR command available in
  219. \fIinterp\fR.  If \fBTcl_RecordAndEval\fR isn't called for an interpreter
  220. then there will be no \fBhistory\fR command in that interpreter.  Second,
  221. \fBTcl_RecordAndEval\fR saves \fIcommand\fR in
  222. the history list for \fBinterp\fR, making a new event to hold the
  223. command.  Third,
  224. \fBTcl_RecordAndEval\fR executes the command by passing it
  225. and \fIflags\fR to \fBTcl_Eval\fR.  If \fIflags\fR is -1 then only
  226. the first two steps are taken;  the command will not be executed.
  227.  
  228. .SH KEYWORDS
  229. command, event, execute, history, interpreter, record
  230.